package sel.me.java.learning.rabbitmq.topic.producer;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import sel.me.java.learning.rabbitmq.ConnectionUtil;

/*
 * 可以理解为Routing的通配符模式，如下图：
 */
public class TopicProducer {

	 private static final String EXCHANGE_NAME = "test_exchange_topic";

	    public static void main(String[] args) throws IOException, TimeoutException {
	        Connection connection = ConnectionUtil.getConnection();
	        Channel channel = connection.createChannel();
	        //声明交换机
	        channel.exchangeDeclare(EXCHANGE_NAME,"topic");
	        String message = "匹配insert";
	        channel.basicPublish(EXCHANGE_NAME,"order.update",false,false,null,message.getBytes());

	        channel.close();
	        connection.close();
	    }
}
